<template>
  <div>
    <el-dialog
      :title="title"
      :width="dialogWidth"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :visible.sync="visible"
      :before-close="BeforeClose"
      top="1vh"
    >
      <el-form
        v-if="visible"
        :model="inputForm"
        ref="inputForm"
        :rules="rules"
        v-loading="loading"
        :class="method === 'view' ? 'readonly' : ''"
        :disabled="method === 'view'"
      >
        <el-row :gutter="15">
          <div>
            <el-collapse v-model="activeName" @change="haChange">
              <el-collapse-item title="基本信息" name="1" disabled >

                <div>

                </div>
                <el-col :span="12" v-if="inputForm.contractTypeId != 2">
                  <el-form-item
                    label="房产类型:"
                    prop="buildingType"
                    label-width="120px"
                  >
                    <el-select
                      style="width: 100%"
                      :disabled="method == 'continue'"
                      v-model="inputForm.buildingType"
                      placeholder="请选择"
                      @change="getselectType(0)"
                    >
                      <el-option
                        v-for="item in proCompanyList"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>

                <el-col :span="12" v-if="inputForm.contractTypeId != 2">
                  <el-form-item
                    label="房屋楼号/区域:"
                    prop="projectTypeId"
                    label-width="120px"
                  >
                    <el-select
                      style="width: 100%"
                      :disabled="method == 'continue'"
                      v-model="inputForm.projectTypeId"
                      placeholder="请选择"
                    >
                      <el-option
                        v-for="item in projectTypeList"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>

                <el-col :span="12" v-if="inputForm.contractTypeId!=2">
                	<el-form-item label="关联房产编号:" prop="ctContractProjectList" label-width="120px">
                		<!--<el-input v-model="inputForm.companyId" placeholder="请输入"></el-input>-->
                		<el-select filterable multiple style="width: 100%;" :disabled="method=='continue'" v-model="inputForm.ctContractProjectList"
                		 placeholder="请选择" @change="ctContractProjectListchange">
                			<el-option v-for="item in rmprojectList" :key="item.value" :label="item.label" :value="item.value">
                			</el-option>
                		</el-select>
                	</el-form-item>
                </el-col>

                <el-col :span="12" >
                	<el-form-item label="面积(㎡):" prop="rentArea" label-width="120px">
                		<el-input v-model="inputForm.rentArea" placeholder="请输入"></el-input>
                	</el-form-item>
                </el-col>
              </el-collapse-item>
              <el-collapse-item
                disabled
                title="购房人信息"
                name="1"
                v-if="inputForm.contractTypeId != 2"
              >
                <el-col :span="12">
                  <el-form-item
                    label="名称:"
                    prop="companyId"
                    label-width="120px"
                  >
                    <el-select
                      filterable
                      style="width: 100%"
                      :disabled="method == 'continue'"
                      v-model="inputForm.companyId"
                      placeholder="请选择"
                      @change="getsyscompanyId"
                    >
                      <el-option
                        v-for="item in companyNameList"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="11">
                  <el-form-item
                    label="联系人:"
                    prop="contactUserName"
                    label-width="120px"
                  >
                    <el-input
                      disabled
                      v-model="inputForm.contactUserName"
                      placeholder="请输入"
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="11">
                  <el-form-item
                    label-width="120px"
                    label="联系方式:"
                    prop="contactUserPhone"
                  >
                    <el-input
                      disabled
                      v-model="inputForm.contactUserPhone"
                      placeholder="请输入"
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="11">
                  <!-- <el-form-item
                    label="纳税人标识号:"
                    prop="taxpayerNumber"
                  > -->
                  <el-form-item label="纳税人识别号:" label-width="120px">
                    <el-input
                      disabled
                      v-model="inputForm.taxpayerNumber"
                      placeholder="请输入"
                    ></el-input>
                  </el-form-item>
                </el-col>
              </el-collapse-item>

              <el-collapse-item
                title="金额信息"
                name="1"
              >
              <el-col :span="8"  >
                  <el-form-item
                    label="签订日期:"
                    prop="signDate"
                    label-width="100px"
                  >
                    <el-date-picker
                      @change="signDateChange"
                      style="width: 100%"
                      v-model="inputForm.signDate"
                      type="date"
                      value-format="yyyy-MM-dd"
                      placeholder="选择日期时间"
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="销售单价:" required label-width="100px">
                    <el-select
                      @change="zjxxchange"
                      v-model="zjxx.taxRateId"
                      placeholder="请选择"
                      clearable
                      style="width: 100%"
                    >
                      <el-option
                        v-for="item in zjxxtaxRateIdList"
                        :key="item.value"
                        :label="item.label + '%'"
                        :value="item.value"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="税率:" label-width="100px">
                    <el-input
                      disabled
                      v-model="zjxx.taxAmount"
                      placeholder="请输入"
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item
                    label="含税合同金额:"
                    label-width="100px"
                  >
                    <el-input
                      disabled
                      v-model="zjxx.incTaxTotalAmount"
                      placeholder="请输入"
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item
                    label="无税合同金额:"
                    label-width="100px"
                  >
                    <el-input
                      disabled
                      v-model="zjxx.noTaxTotalAmount"
                      placeholder="请输入"
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="税金" label-width="100px">
                    <el-input
                      @blur="guaranteeAmountchange"
                      v-model="zjxx.guaranteeAmount"
                      placeholder="请输入"
                    ></el-input>
                  </el-form-item>
                </el-col>

                <el-col :span="8">
                  <el-form-item
                    label="付款时间:"
                    prop="payTime"
                    label-width="100px"
                  >
                    <el-date-picker
                      @change="signDateChange"
                      style="width: 100%"
                      v-model="inputForm.payTime"
                      type="date"
                      value-format="yyyy-MM-dd"
                      placeholder="选择日期时间"
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>
                 <el-col :span="8">
                  <el-form-item label="付款方式:" label-width="100px">
                    <el-select
                      v-model="inputForm.payType"
                      placeholder="请选择"
                      clearable
                      style="width: 100%"
                    >
                      <el-option
                        v-for="item in payTypeList"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                 <el-col :span="8">
                  <el-form-item label="付款金额:" label-width="100px">
                    <el-input
                      v-model="inputForm.payMoney"
                      placeholder="请输入"
                      :disabled="true"
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                	<el-form-item label="合同状态:" prop="contractStatus" label-width="180px">
                		<el-radio-group :disabled="method=='continue'" v-model="inputForm.contractStatus" style="width:80%;" @change="contractStatusChange">
                			<el-radio :label=1>已签</el-radio>
                			<el-radio :label=0>未签</el-radio>
                		</el-radio-group>
                	</el-form-item>
                </el-col>
                <el-col :span="12" v-if="inputForm.contractStatus==1">
                	<el-form-item label="签订日期:" prop="signDate" label-width="180px">
                		<el-date-picker @change="signDateChange" style="width: 100%;" v-model="inputForm.signDate" type="date"
                		 value-format="yyyy-MM-dd" placeholder="选择日期时间">
                		</el-date-picker>
                	</el-form-item>
                </el-col>
              </el-collapse-item>
            </el-collapse>
          </div>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
      	<el-button @click="BeforeClose" icon="el-icon-circle-close">取 消</el-button>
      	<el-button type="primary" icon="el-icon-circle-check" v-if="method != 'view'" @click="doSubmit()">提 交</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { tableMarketOption } from '@/const/crud/market/contract/person'
import {
  getObj,
  addObj,
  putObj,
  getContractTaxRateList,
  getContractType,
  getChargeUnitpPriceList,
  getProjectList,
  getCompanyList,
  uploadFile,
  getCompanyByPhone,
  syscompanyid,
  selectType,
  calculation,
  relet
} from '@/api/market/contractSale/person'
import {
  contractServiceCharge,
  contractServiceTaxRate,
  contractRentCharge,
  contractRentTaxRate
} from '@/api/dicdata'
import { getDicType } from '@/api/common'
import {
  getProjectType,
  getProjectStatus,
  getProjectpProperty
} from '@/api/market/estate/rmproject'
import { mapGetters } from 'vuex'
import store from '@/store'
import { getStore } from '@/util/store'
//import { getStore } from '../util/store'

export default {
  data() {
    var validatePass = (rule, value, callback) => {
      if (!value.length) {
        callback(new Error('不能为空'))
      } else {
        callback()
      }
    }
    return {
      state1: '',
      totalMonthNumber: 0, //租赁总月份
      title: '',
      tabletitle: '',
      dialogWidth: '50%',
      page: {
        //current: 1, // 当前页数
        size: -1 // 每页显示多少条
      },
      method: '',
      headers: {
        Authorization: 'Bearer ' + store.getters.access_token,
        tenantId: 0
      },
      filedata: {
        remarks: '',
        uploadPath: 'user/path'
      },
      dateall: [],
      file: null,
      tableIndex: 0,
      tableRowId: '',
      dialogStatus: 'add',
      showForm: false,
      showProjectForm: false,
      visible: false,
      loading: false,
      tableCount: 0,
      tableMethod: '',
      moenyCount: 3,
      companyNmae: '',
      guaranteeAmount: '',
      contractMonth: 0, //合同计算是月份差
      projectArea: 0, //面积
      unitPrice: 0, //单价
      taxRate: 0, //税率
      ctContractFileLists: [],
      companyNameList: [], //公司名称列表
      rulesProject: {
        buildingTypes: [
          {
            required: true,
            message: '房产类型不能为空',
            trigger: 'blur'
          }
        ],
        projectIds: [
          {
            required: true,
            message: '关联房间号不能为空',
            trigger: 'blur'
          }
        ]
      },
      tableFormIndex: 0,
      //服务费
      tableForm: {
        id: '',
        rowIndex: 0,
        projectId: '', //关联房产ID
        projectName: '', //关联房产名称
        projectBuildingId: '', //房产类型Id
        projectBuildName: '', //房产类型
        projectArea: '', //房产面积
        chargeType: 0, //1.市场管理费 2.租金 3.租赁保证金
        unitPriceId: '', //单价 id
        unitPrice: '', //单价
        taxRateId: '', //税率
        taxRate: '', //税率id
        incTaxTotalAmount: 0, //含税金额
        noTaxTotalAmount: 0, //不含税金额
        taxAmount: 0, //税金
        totalAmount: 0, //总金额
        guaranteeAmount: 0 //租赁保证金 chargeType为3
      },
      //合同账单
      tableBillForm: {
        projectBuildingId: '',
        projectName: '',
        projectArea: 0,
        chargeType: 0, //1.市场管理服务费 2.租金 3.合同保证金
        unitPrice: '',
        billStartTime: '',
        billEndTime: '',
        billCost: 0 //应收金额
      },
      proProjectData: [], //租赁房产table列表
      tableMarketData: [], //市场服务费table列表
      tableRentData: [], //租金服务费table列表
      tableBillData: [], //合同账单table列表
      tableFileData: [],
      proBuildTypeList: [],
      rmprojectList: [], //房产编号
      scglunitPriceIdList: [], //市场管理服务费
      scgltaxRateIdList: [],
      zjxxunitPriceIdList: [],
      zjxxtaxRateIdList: [],
      proProData: {
        buildingType: '',
        projectId: '', //关联房产ID
        projectName: '',
        projectArea: '',
        buildingTypeName: ''
      },
      proCompanyList: [], //获取公司数据
      proProjectList: [], //获取房产数据
      proTaxRateList: [], //税率
      proUnitpPriceList: [], //单价
      fileList: [],
      fileLists: [],
      activeName: ['1', '2', '3'],
      contractTypeList: [],
      projectTypeList: [],
      payTypeList: [],
      inputForm: {
        id: '',
        contractTypeId: '', //合同分类
        buildingType: '', //房产类型
        companyId: '', //公司id
        companyName: '', //公司名称
        contractNumber: '', //合同编号
        belonger: '', //产权人
        taxpayerNumber: '', //纳税人识别号
        discountTime: '', //优惠月数
        contactUserName: '', //联系人、联系方式
        contactUserPhone: '',
        rentEndTime: '',
        rentStartTime: '', //租赁开始日期
        discountEndTime: '',
        discountStartTime: '',
        contractTotalAmount: 0, //合同总金额
        contractStatus: 1,
        signDate: '', //签订日期
        ctContractChargeSummary: [], //各种费用  //费用类型(1.市场管理费 2.租金 3.租赁保证金)
        // blChargeBillList: [], //合同账单
        // ctContractFileList: [], //上传文件
        ctContractProjectList: [], //房产id集合
        // ctContractProjectList: '', //房产id集合(不能多选)
        dateall: [],
        advertisingLocation: '',
        advertisingCount: '',
        advertisingLength: '',
        advertisingWidth: '',
        advertisingArea: '',
        advertisingType: '',
        advertisingUnitPrice: '',

        projectTypeId: '',
        rentArea: '',
        serviceStartTime: '',
        serviceMonth: "12",
        serviceTime: '',
        serviceCostTime: '',
        payTime:'',
        payMoney:'',
      },
      scgl: {
        chargeType: 1,
        unitPriceId: '',
        taxRateId: '',
        incTaxTotalAmount: 0,
        noTaxTotalAmount: 0,
        taxAmount: 0,
        totalAmount: 0
      },
      contractTotalAmount: '',
      zjxx: {
        chargeType: 2,
        unitPriceId: '',
        taxRateId: '',
        incTaxTotalAmount: 0,
        noTaxTotalAmount: 0,
        taxAmount: 0,
        totalAmount: 0,
        guaranteeAmount: 0,
        remarks: ''
      },
      MaxMonth: 0, //最大月份
      // 续租时间是否改变过，
      isChangeDate: false,
      // 表单校验
      rules: {
        advertisingLocation: [
          {
            required: true,
            message: '位置不能为空',
            trigger: 'blur'
          }
        ],
        advertisingCount: [
          {
            required: true,
            message: '位置不能为空',
            trigger: 'blur'
          }
        ],
        advertisingLength: [
          {
            required: true,
            message: '长度不能为空',
            trigger: 'blur'
          }
        ],
        advertisingWidth: [
          {
            required: true,
            message: '宽度不能为空',
            trigger: 'blur'
          }
        ],
        advertisingArea: [
          {
            required: true,
            message: '面积不能为空',
            trigger: 'blur'
          }
        ],
        advertisingType: [
          {
            required: true,
            message: '请选择类型',
            trigger: 'blur'
          }
        ],
        advertisingUnitPrice: [
          {
            required: true,
            message: '单价不能为空',
            trigger: 'blur'
          }
        ],
        buildingType: [
          {
            required: true,
            message: '房产类型不能为空',
            trigger: 'change'
          }
        ],
        dateall: [
          {
            required: true,
            message: '合同开始日期不能为空',
            trigger: 'change'
          }
        ],
        rentEndTime: [
          {
            required: true,
            message: '合同结束日期不能为空',
            trigger: 'blur'
          }
        ],
        signDate: [
          {
            required: true,
            message: '合同签订日期不能为空',
            trigger: 'blur'
          }
        ],
        contractNumber: [
          {
            required: true,
            message: '合同编号不能为空',
            trigger: 'blur'
          }
        ],
        contractTypeId: [
          {
            required: true,
            message: '合同类型不能为空',
            trigger: 'blur'
          }
        ],
        taxpayerNumber: [
          {
            required: true,
            message: '纳税人识别号不能为空',
            trigger: 'blur'
          }
        ],
        contactUserName: [
          {
            required: true,
            message: '联系人不能为空',
            trigger: 'blur'
          }
        ],
        contactUserPhone: [
          {
            required: true,
            message: '联系方式不能为空',
            trigger: 'blur'
          }
        ],
        companyId: [
          {
            required: true,
            message: '公司名称不能为空',
            trigger: 'blur'
          },
          {
            required: true,
            message: '公司名称不能为空',
            trigger: 'change'
          }
        ],
        ctContractProjectList: [
          {
            required: true,
            message: '关联房产编号不能为空',
            trigger: 'blur'
          },
          {
            required: true,
            message: '关联房产编号不能为空',
            trigger: 'change'
          }
        ],
        rentArea: [
          {
            required: true,
            message: '面积不能为空',
            trigger: 'blur'
          },
          {
            required: true,
            message: '关面积不能为空',
            trigger: 'change'
          }
        ],
        payTime: [
          {
            required: true,
            message: '付款日期不能为空',
            trigger: 'blur'
          }
        ],
        payType: [
          {
            required: true,
            message: '支付类型不能为空',
            trigger: 'blur'
          },
          {
            required: true,
            message: '支付类型不能为空',
            trigger: 'change'
          }
        ],
        payMoney: [
          {
            required: true,
            message: '支付金额不能为空',
            trigger: 'blur'
          },
          {
            required: true,
            message: '支付金额不能为空',
            trigger: 'change'
          }
        ],
      },
      scglcalculationList: [],
      zjxxcalculationList: [],
      allcalculationList: [],
      advertisingTypeOption: [],
      newList: []
    }
  },
  created() {
    this.headers.tenantId = getStore({
      name: 'tenantId'
    })
  },
  methods: {
    BeforeClose() {
      this.visible = false
      if (this.$refs.inputForm) {
        this.$refs.inputForm.resetFields()
        this.$refs.inputForm.clearValidate()
      }
    },
    test(value, callback) {
      if (value) {
        value = value
          .replace(/[^\d.]/g, '')
          .replace(/\.{2,}/g, '.')
          .replace('.', '$#$')
          .replace(/\./g, '')
          .replace('$#$', '.')
          .replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3')
          .replace(/^\./g, '')
      }
      if (callback) {
        callback()
      }
      return value
    },
    tests(value) {
      if (value) {
        value = value.replace(/[^\d]/g, '')
      }
      return value
    },
    getAllTotoalMoney() {
      if (
        this.inputForm.advertisingLength > 0 &&
        this.inputForm.advertisingWidth > 0
      ) {
        this.inputForm.advertisingArea =
          this.inputForm.advertisingLength * this.inputForm.advertisingWidth
      }
      if (
        this.inputForm.contractTypeId != 2 ||
        !this.inputForm.advertisingType ||
        !this.inputForm.advertisingArea ||
        !this.inputForm.advertisingCount ||
        this.inputForm.dateall.length != 2 ||
        !this.inputForm.advertisingUnitPrice
      ) {
        return
      }
      calculation({
        contractTypeId: this.inputForm.contractTypeId,
        advertisingArea: this.inputForm.advertisingArea,
        advertisingType: this.inputForm.advertisingType,
        advertisingCount: this.inputForm.advertisingCount,
        advertisingUnitPrice: this.inputForm.advertisingUnitPrice,
        rentEndTime:
          this.inputForm.contractTypeId != 1
            ? this.inputForm.dateall[1].substr(0, 10)
            : null,
        rentStartTime:
          this.inputForm.contractTypeId != 1
            ? this.inputForm.dateall[0].substr(0, 10)
            : null
      }).then((data) => {
        this.inputForm.contractTotalAmount = JSON.stringify(
          data.data.data[0].totalAmount
        )
        this.contractTotalAmount = this.inputForm.contractTotalAmount
        this.newList = data.data.data
      })
    },
    contractStatusChange() {
      this.inputForm.signDate = ''
      if (this.inputForm.contractTypeId == 0) {
        this.zjxxchange()
      }
    },
    contractTypechange() {
      if (this.$refs.inputForm) {
        this.$refs.inputForm.clearValidate()
      }
      if (this.inputForm.contractTypeId != 0) {
        this.zjxx = this.$options.data().zjxx
        if (this.inputForm.contractTypeId == 1) {
          this.scglchange()
        } else {
          this.getAllTotoalMoney()
        }
      } else {
        this.scglchange()
        this.zjxxchange()
      }
    },
    guaranteeAmountchange() {
      if (this.zjxx.guaranteeAmount != '') {
        if (this.inputForm.contractTypeId == 0) {
          this.zjxxchange()
        }
      }
    },
    discountTimechange() {
      this.scglchange()
      if (this.inputForm.contractTypeId == 0) {
        this.zjxxchange()
      }
    },
    ctContractProjectListchange() {
      console.log(this.inputForm.ctContractProjectList)
      if (this.inputForm.ctContractProjectList.length > 0) {
        // if (this.inputForm.ctContractProjectList) {
        this.scglchange()
        if (this.inputForm.contractTypeId == 0) {
          this.zjxxchange()
        }
      }
    },
    scglchange() {
      // if ((this.inputForm.dateall.length != 2 || this.inputForm.ctContractProjectList.length == 0) && !this.inputForm.signDate) {
      if (
        (this.inputForm.dateall.length != 2 ||
          this.inputForm.ctContractProjectList.length == 0) &&
        this.inputForm.contractTypeId != 1
      ) {
        // if ((this.inputForm.dateall.length != 2 || !this.inputForm.ctContractProjectList) && this.inputForm.contractTypeId != 1) {
        return
      }
      if (
        !(
          this.inputForm.contractTypeId == 1 ||
          this.inputForm.contractTypeId == 0
        )
      ) {
        return
      }
      if (this.inputForm.ctContractProjectList.length == 0) {
        // if (!this.inputForm.ctContractProjectList) {
        return
      }
      if (this.scgl.unitPriceId && this.scgl.taxRateId) {
        calculation({
          ids: this.inputForm.ctContractProjectList,
          // ids: [this.inputForm.ctContractProjectList],
          type: 0,
          unitPriceId: this.scgl.unitPriceId.replace('元/㎡.月', ''),
          taxRateId: this.scgl.taxRateId.replace('%', ''),
          discountTime: this.inputForm.discountTime,
          contractTypeId: this.inputForm.contractTypeId,
          // signDate: this.inputForm.signDate,
          rentEndTime:
            this.inputForm.contractTypeId != 1
              ? this.inputForm.dateall[1].substr(0, 10)
              : null,
          rentStartTime:
            this.inputForm.contractTypeId != 1
              ? this.inputForm.dateall[0].substr(0, 10)
              : null
        }).then((data) => {
          let id = null
          if (this.scglcalculationList.length > 0) {
            id = this.scglcalculationList[0].id
          }
          this.scglcalculationList = data.data.data
          if (this.scglcalculationList.length > 0) {
            this.scglcalculationList[0].id = id
          }
          this.scgl.incTaxTotalAmount = 0
          this.scgl.noTaxTotalAmount = 0
          this.scgl.taxAmount = 0
          this.scgl.totalAmount = 0
          for (var i = 0; i < data.data.data.length; i++) {
            this.scgl.incTaxTotalAmount = (
              this.scgl.incTaxTotalAmount + data.data.data[i].incTaxTotalAmount
            ).toFixed(2)
            this.scgl.noTaxTotalAmount = (
              this.scgl.noTaxTotalAmount + data.data.data[i].noTaxTotalAmount
            ).toFixed(2)
            this.scgl.taxAmount = (
              this.scgl.taxAmount + data.data.data[i].taxAmount
            ).toFixed(2)
            this.scgl.totalAmount = (
              this.scgl.totalAmount + data.data.data[i].totalAmount
            ).toFixed(2)
          }
        })
      }
    },
    signDateChange() {
      if (this.inputForm.contractStatus === 0) {
        this.zjxxchange()
      }
      if (
        this.inputForm.contractStatus === 1 ||
        this.inputForm.contractStatus === 0
      ) {
        this.scglchange()
      }
    },
    zjxxchange(e) {
      if(this.inputForm.rentArea!==''){
        this.inputForm.payMoney=(e/100*this.inputForm.rentArea).toFixed(2)
      }
      if (
        this.zjxx.unitPriceId &&
        this.zjxx.taxRateId &&
        this.zjxx.guaranteeAmount >= 0
      ) {
        if (!(this.inputForm.contractTypeId == 0)) {
          return
        }
        if (
          !this.inputForm.dateall.length &&
          this.inputForm.dateall.length < 2
        ) {
          return
        }
        if (this.inputForm.ctContractProjectList.length == 0) {
          // if (!this.inputForm.ctContractProjectList) {
          return
        }
        calculation({
          ids: this.inputForm.ctContractProjectList,
          // ids: [this.inputForm.ctContractProjectList],
          type: 1,
          contractTypeId: this.inputForm.contractTypeId,
          unitPriceId: this.zjxx.unitPriceId.replace('元/㎡.月', ''),
          taxRateId: this.zjxx.taxRateId.replace('%', ''),
          discountTime: this.inputForm.discountTime,
          // signDate: this.inputForm.signDate,
          rentEndTime:
            this.inputForm.contractTypeId != 1
              ? this.inputForm.dateall[1].substr(0, 10)
              : null,
          rentStartTime:
            this.inputForm.contractTypeId != 1
              ? this.inputForm.dateall[0].substr(0, 10)
              : null,
          guaranteeAmount: this.zjxx.guaranteeAmount
            ? this.zjxx.guaranteeAmount
            : 0
        }).then((data) => {
          let id = null
          if (this.zjxxcalculationList.length > 0) {
            id = this.zjxxcalculationList[0].id
          }
          this.zjxxcalculationList = data.data.data
          if (this.zjxxcalculationList.length > 0) {
            this.zjxxcalculationList[0].id = id
          }
          this.zjxx.incTaxTotalAmount = 0
          this.zjxx.noTaxTotalAmount = 0
          this.zjxx.taxAmount = 0
          this.zjxx.totalAmount = 0
          for (var i = 0; i < data.data.data.length; i++) {
            this.zjxx.incTaxTotalAmount = (
              this.zjxx.incTaxTotalAmount + data.data.data[i].incTaxTotalAmount
            ).toFixed(2)
            this.zjxx.noTaxTotalAmount = (
              this.zjxx.noTaxTotalAmount + data.data.data[i].noTaxTotalAmount
            ).toFixed(2)
            this.zjxx.taxAmount = (
              this.zjxx.taxAmount + data.data.data[i].taxAmount
            ).toFixed(2)
            this.zjxx.totalAmount = (
              this.zjxx.totalAmount + data.data.data[i].totalAmount
            ).toFixed(2)
          }
        })
      }
    },
    // 多图片上传
    handleChanged(raw) {
      this.fileLists.push(raw.file)
      // this.fileList = raw
    },
    // 通过公司名称获取信息
    getsyscompanyId(val) {
      this.companyNameList.forEach((item) => {
        if (this.inputForm.companyId == item.value) {
          this.inputForm.companyName = item.label
        }
      })
      syscompanyid({}, this.inputForm.companyId).then((data) => {
        this.inputForm.taxpayerNumber = data.data.data.taxRateNumber
        this.inputForm.contactUserPhone = data.data.data.contactPhone
        this.inputForm.contactUserName = data.data.data.contactName
      })
    },
    // 通过房产类型获取房产编号
    getselectType(type) {
      if (!type) {
        this.inputForm.ctContractProjectList = []
        // this.inputForm.ctContractProjectList = ''
      }
      let typeId = 0
      if (this.method === 'add') {
        typeId = 0
      } else {
        typeId = 1
      }
      console.log(this.inputForm.buildingType)
      getDicType(this.inputForm.buildingType).then((res) => {
        this.projectTypeList = res.data.data
      })
      selectType({}, this.inputForm.buildingType, typeId).then((data) => {
        this.rmprojectList = data.data.data
      })
    },
    //获取附件数据
    getFile() {
      //获取文件方法
      getFileList().then((response) => {
        if (response.data != null) {
          this.tableFileData = response.data.data.records
        }
      })
    },
    onChangeProjectData: function () {
      var that = this
      var objProject = that.proProjectList.find(function (item) {
        return item.projectId === that.tableForm.projectId
      })
      that.projectArea = objProject.projectArea
    },
    onChangeUnitPrice: function () {
      var that = this
      var objPrice = that.proUnitpPriceList.find(function (item) {
        return item.id === that.tableForm.unitPriceId
      })
      that.unitPrice = objPrice.unitPrice
    },
    onChangeTaxRate: function () {
      var that = this
      var objTaxRate = that.proTaxRateList.find(function (item) {
        return item.id === that.tableForm.taxRateId
      })
      that.taxRate = objTaxRate.taxRate
    },
    // 表头样式设置
    headClass() {
      return 'text-align: center;background:#fafafa;'
    },
    // 表格样式设置
    rowClass() {
      return 'text-align: center;'
    },
    haChange(val) {
      // console.log(val);
    },
    //租赁房产
    //删除
    deleteProjectRow(index, rows) {
      rows.splice(index, 1)
    },
    editProjectRow: function (index, row) {
      var that = this
      ;(that.tableIndex = index),
        (that.dialogStatus = 'edit'),
        (that.showProjectForm = true)
      that.proProData = Object.assign({}, row)
    },
    addProjrctForm: function () {
      var that = this
      ;(that.dialogStatus = 'add'), (that.showProjectForm = true)
      var listWorks = {
        buildingType: '',
        projectId: ''
      }
      this.$nextTick(function () {
        this.proProData = Object.assign({}, listWorks)
      })
    },
    do_cancel_project: function () {
      this.showProjectForm = false
      this.$refs['ruleFormProjectTable'].resetFields()
    },
    do_save_project: function () {
      var that = this

      var objProject = that.proProjectList.find(function (item) {
        return item.id === that.proProData.projectId
      })
      that.proProData.projectName = objProject.projectName
      that.proProData.projectArea = objProject.projectArea
      var objType = that.proBuildTypeList.find(function (item) {
        return item.buildingType === that.proProData.buildingType
      })
      that.proProData.buildingTypeName = objType.typeName
      //新增赋值
      if (that.dialogStatus == 'add') {
        that.proProjectData.push(that.proProData)
      }
      //修改赋值
      if (that.dialogStatus == 'edit') {
        that.$set(that.proProjectData, that.tableIndex, that.proProData)
      }
      this.showProjectForm = false
    },
    //市场管理服务费
    //删除
    deleteRow(index, rows) {
      rows.splice(index, 1)
    },
    //修改（市场管理服务费/租金）
    editRow: function (index, row) {
      var that = this
      that.tableIndex = row.rowIndex
      that.tableRowId = row.id
      that.dialogStatus = 'edit'
      that.showForm = true
      //获取单价getChargeUnitpPriceList chargeType 1.市场管理服务费 2.租金
      var query = {
        size: -1,
        chargeType: row.chargeType
      }
      getChargeUnitpPriceList(query).then((response) => {
        if (response.data != null) {
          this.proUnitpPriceList = response.data.data.records
        }
      })
      that.tableForm = Object.assign({}, row)
    },
    //新增（市场管理服务费/租金）
    addForm: function (method, id) {
      var that = this
      if (that.proProjectData == [] || that.proProjectData.length <= 0) {
        this.$notify.success('请关联"租赁房产"后再操作！')
        return
      }
      if (that.inputForm.rentStartTime == '') {
        this.$notify.success('请选择合同租赁开始时间！')
        return
      }
      if (that.inputForm.rentEndTime == '') {
        this.$notify.success('请选择合同租赁结束时间！')
        return
      }

      that.showForm = true
      ;(that.dialogStatus = 'add'), (that.tableMethod = method)
      if (method === '1') {
        this.tabletitle = `新增市场管理服务费`
      } else if (method === '2') {
        this.tabletitle = '新增租金'
      }
      //获取单价getChargeUnitpPriceList chargeType 1.市场管理服务费 2.租金
      var chargeType = method === '1' ? 1 : 2
      var query = {
        size: -1,
        chargeType: chargeType
      }
      getChargeUnitpPriceList(query).then((response) => {
        if (response.data != null) {
          this.proUnitpPriceList = response.data.data.records
        }
      })

      //新增
      var listWork = {
        id: '',
        contractId: '',
        companyId: '',
        projectBuildingId: '',
        chargeType: 0,
        unitPriceId: '',
        taxRateId: '',
        incTaxTotalAmount: 0,
        noTaxTotalAmount: '',
        taxAmount: '',
        totalAmount: ''
      }
      this.$nextTick(function () {
        this.tableForm = Object.assign({}, listWork)
        if (method === '1') {
          this.tableForm.chargeType = 1
        } else if (method === '2') {
          this.tableForm.chargeType = 2
        }
      })
    },
    do_cancel_charge: function () {
      this.showForm = false
      this.$refs['ruleFormTable'].resetFields()
    },
    //保存（市场管理服务费/租金）
    do_save_charge: function () {
      var that = this
      var objProject = that.proProjectData.find(function (item) {
        return item.projectId === that.tableForm.projectId
      })
      that.tableForm.projectName = objProject.projectName
      that.tableForm.buildingType = objProject.buildingType
      that.tableForm.buildingTypeName = objProject.buildingTypeName
      that.tableForm.projectArea = Number(objProject.projectArea || 0)

      var objUnitPrice = that.proUnitpPriceList.find(function (item) {
        return item.id === that.tableForm.unitPriceId
      })
      that.tableForm.unitPrice = Number(objUnitPrice.unitPrice || 0)

      var objTaxRate = that.proTaxRateList.find(function (item) {
        return item.id === that.tableForm.taxRateId
      })
      that.tableForm.taxRate = Number(objTaxRate.taxRate)
      //计算含税合同金额
      that.tableForm.incTaxTotalAmount = (
        that.tableForm.unitPrice *
        that.tableForm.projectArea *
        12
      ).toFixed(2)
      //计算无税合同金额
      that.tableForm.noTaxTotalAmount = (
        that.tableForm.incTaxTotalAmount /
        (1 + objTaxRate.taxRate * 0.01)
      ).toFixed(2)
      //计算税率
      that.tableForm.taxAmount = (
        that.tableForm.noTaxTotalAmount *
        objTaxRate.taxRate *
        0.01
      ).toFixed(2)
      //计算总金额
      that.tableForm.totalAmount = (
        that.tableForm.incTaxTotalAmount *
        (that.totalMonthNumber / 12)
      ).toFixed(2)

      that.tableForm.chargeType = that.tableMethod

      var tableBillForm = {
        projectBuildingId: '',
        projectName: '',
        projectArea: 0,
        chargeType: 0,
        unitPrice: '',
        billStartTime: '',
        billEndTime: '',
        billCost: 0
      }
      tableBillForm.projectBuildingId = that.tableForm.projectBuildingId
      tableBillForm.projectArea = that.projectArea
      tableBillForm.chargeType = that.tableForm.chargeType
      tableBillForm.unitPrice = that.unitPrice
      tableBillForm.billCost = that.tableForm.totalAmount

      //新增赋值
      if (that.dialogStatus == 'add') {
        that.tableFormIndex++
        that.tableForm.rowIndex = that.tableFormIndex
        that.inputForm.ctContractChargeSummary.push(that.tableForm)
        // that.inputForm.blChargeBillList.push(tableBillForm);
      }
      //修改赋值
      if (that.dialogStatus == 'edit') {
        for (
          var i = 0;
          i < that.inputForm.ctContractChargeSummary.length;
          i++
        ) {
          if (
            that.tableRowId == that.inputForm.ctContractChargeSummary[i].id &&
            that.tableRowId
          ) {
            that.tableIndex = i
          } else if (
            that.tableIndex ==
              that.inputForm.ctContractChargeSummary[i].rowIndex &&
            that.inputForm.ctContractChargeSummary[i].rowIndex
          ) {
            that.tableIndex = i
          }
        }
        that.$set(
          that.inputForm.ctContractChargeSummary,
          that.tableIndex,
          that.tableForm
        )
        //that.$set(that.tableMarketData, that.tableIndex, that.tableForm);
      }
      //控制dialog显示/隐藏
      this.showForm = false
    },
    //点击计算合同账单
    addBillForm: function () {
      var that = this
      //that.inputForm.blChargeBillList=
    },
    handleRemove(file, fileList) {
      let removeIndex = -1
      this.fileLists.forEach((item, index) => {
        if (item.name == file.name) {
          removeIndex = index
        }
      })
      if (removeIndex >= 0) {
        this.fileLists.splice(removeIndex, 1)
      }
      console.log(this.fileLists)
    },
    //上传成功
    onFileSuccess(response, file, fileList) {
      var that = this
      if (response.data != null) {
        var fileArry = {
          fileId: ''
        }
        response.data = (response.data || '') + ''
        fileArry.fileId = response.data
        that.ctContractFileLists.push(fileArry)
      }
    },
    //上传文件
    handleChange(file, fileList) {
      this.fileList = fileList.slice(-3)
    },
    init(method, id) {
      this.visible = true

      // setTimeout(() => {
      this.inputForm.contractTypeId = 1
      this.fileList = []
      this.fileLists = []
      this.method = method
      this.inputForm.id = id
      if (method === 'add') {
        this.title = `新建合同`
      } else if (method === 'edit') {
        this.title = '修改合同'
      } else if (method === 'view') {
        this.title = '查看合同'
      } else if (method === 'continue') {
        this.title = '续租合同'
        this.isChangeDate = false
      }

      this.loading = false
      this.$nextTick(() => {
        // 获取公司名称
        getCompanyByPhone().then((response) => {
          if (response.data != null) {
            this.companyNameList = response.data.data
          }
        })
        getDicType('sales_house_type').then((res) => {
          this.proCompanyList = res.data.data
        })
        getDicType('contract_type').then((res) => {
          this.contractTypeList = res.data.data
        })
        getDicType('advertising_type').then((res) => {
          this.advertisingTypeOption = res.data.data
        })
        getDicType('sale_pay_type').then((res) => {
          this.payTypeList = res.data.data
        })
        if (this.$refs.inputForm) {
          this.$refs.inputForm.clearValidate()
        }
        if (method === 'add' || method === 'edit' || method === 'continue') {
          this.inputForm = this.$options.data().inputForm
          this.inputForm.dateall = []
          // this.scgl = this.$options.data().scgl
          // this.zjxx = this.$options.data().zjxx
          this.scgl = {
            chargeType: 1,
            unitPriceId: '',
            taxRateId: '',
            incTaxTotalAmount: 0,
            noTaxTotalAmount: 0,
            taxAmount: 0,
            totalAmount: 0
          }
          this.zjxx = {
            chargeType: 2,
            unitPriceId: '',
            taxRateId: '',
            incTaxTotalAmount: 0,
            noTaxTotalAmount: 0,
            taxAmount: 0,
            totalAmount: 0,
            guaranteeAmount: 0,
            remarks: ''
          }
          this.contractTotalAmount = ''
          this.inputForm.ctContractChargeSummary = []
          // this.inputForm.blChargeBillList = [];
          this.inputForm.ctContractFileList = []
          contractServiceCharge().then((res) => {
            this.scglunitPriceIdList = res.data.data
          })
          contractServiceTaxRate().then((res) => {
            this.scgltaxRateIdList = res.data.data
            this.zjxxtaxRateIdList = res.data.data
          })
          contractRentCharge().then((res) => {
            this.zjxxunitPriceIdList = res.data.data
          })
          //新增时清空值
          //this.proProjectData=[];
          //this.tableMarketData=[];
          //this.tableRentData= [];
          //this.tableBillData=[];
        }
        if (method === 'edit' || method === 'view' || method === 'continue') {
          // 修改或者查看

          getObj(id).then((response) => {
            this.inputForm = response.data.data
            // 不多选的
            // this.inputForm.ctContractProjectList = this.inputForm.ctContractProjectList[0]
            if (this.inputForm.contractTypeId != 2) {
              this.getselectType(1)
            }
            var dateArr = []
            if (this.inputForm.rentStartTime && this.inputForm.rentEndTime) {
              dateArr[0] = this.inputForm.rentStartTime
              dateArr[1] = this.inputForm.rentEndTime
            }
            this.inputForm.dateall = dateArr
            this.dateall = dateArr
            // this.inputForm.dateall.push(this.inputForm.rentStartTime)
            // this.inputForm.dateall.push(this.inputForm.rentEndTime)
            this.inputForm.buildingType = this.inputForm.buildingType + ''
            this.inputForm.contractTypeId = this.inputForm.contractTypeId + ''
            this.scgl.incTaxTotalAmount = 0
            this.scgl.noTaxTotalAmount = 0
            this.scgl.taxAmount = 0
            this.scgl.totalAmount = 0
            this.zjxx.incTaxTotalAmount = 0
            this.zjxx.noTaxTotalAmount = 0
            this.zjxx.taxAmount = 0
            this.zjxx.totalAmount = 0
            this.zjxx.guaranteeAmount = 0
            this.scglcalculationList = []
            this.zjxxcalculationList = []
            if (response.data.data.contractTypeId == 2) {
              this.inputForm.contractTotalAmount = JSON.stringify(
                response.data.data.ctContractChargeSummaryList[0].totalAmount
              )
              this.contractTotalAmount = this.inputForm.contractTotalAmount
            }
            for (
              var i = 0;
              i < this.inputForm.ctContractChargeSummaryList.length;
              i++
            ) {
              if (
                this.inputForm.ctContractChargeSummaryList[i].chargeType == 0
              ) {
                this.scglcalculationList.push(
                  this.inputForm.ctContractChargeSummaryList[i]
                )
                this.scgl.unitPriceId =
                  this.inputForm.ctContractChargeSummaryList[i].unitPriceId +
                  '元/㎡.月'
                this.scgl.taxRateId =
                  this.inputForm.ctContractChargeSummaryList[i].taxRateId + '%'
                this.scgl.incTaxTotalAmount =
                  this.scgl.incTaxTotalAmount +
                  this.inputForm.ctContractChargeSummaryList[i]
                    .incTaxTotalAmount
                this.scgl.noTaxTotalAmount =
                  this.scgl.noTaxTotalAmount +
                  this.inputForm.ctContractChargeSummaryList[i].noTaxTotalAmount
                this.scgl.taxAmount =
                  this.scgl.taxAmount +
                  this.inputForm.ctContractChargeSummaryList[i].taxAmount
                this.scgl.totalAmount =
                  this.scgl.totalAmount +
                  this.inputForm.ctContractChargeSummaryList[i].totalAmount
              }
              if (
                this.inputForm.ctContractChargeSummaryList[i].chargeType == 1
              ) {
                this.zjxxcalculationList.push(
                  this.inputForm.ctContractChargeSummaryList[i]
                )
                this.zjxx.unitPriceId =
                  this.inputForm.ctContractChargeSummaryList[i].unitPriceId +
                  '元/㎡.月'
                this.zjxx.taxRateId =
                  this.inputForm.ctContractChargeSummaryList[i].taxRateId + '%'
                this.zjxx.guaranteeAmount = this.inputForm.ctContractChargeSummaryList[
                  i
                ].guaranteeAmount
                this.zjxx.incTaxTotalAmount =
                  this.zjxx.incTaxTotalAmount +
                  this.inputForm.ctContractChargeSummaryList[i]
                    .incTaxTotalAmount
                this.zjxx.noTaxTotalAmount =
                  this.zjxx.noTaxTotalAmount +
                  this.inputForm.ctContractChargeSummaryList[i].noTaxTotalAmount
                this.zjxx.taxAmount =
                  this.zjxx.taxAmount +
                  this.inputForm.ctContractChargeSummaryList[i].taxAmount
                this.zjxx.totalAmount =
                  this.zjxx.totalAmount +
                  this.inputForm.ctContractChargeSummaryList[i].totalAmount
              }
            }
          })
        }
      })
      // }, 5)
    },
    // 手动校验
    ischceked(value) {
      if (value) {
        return false
      } else {
        return true
      }
    },
    // 表单提交
    doSubmit() {
      // console.log(this.inputForm)
      this.inputForm.contractTypeId = 1
      console.log(this.zjxx.guaranteeAmount)
      this.$refs['inputForm'].validate((valid) => {
        if (valid) {
          this.inputForm.contractTypeId = parseInt(
            this.inputForm.contractTypeId
          )
          let formdata = {}
          let array = []
          if (this.inputForm.contractTypeId == 1 || this.inputForm.contractTypeId == 0) {
          	// this.inputForm.buildingType = parseInt(this.inputForm.buildingType)
          	array.push(...this.scglcalculationList)
          	if (this.inputForm.contractTypeId == 0) {
          		array.push(...this.zjxxcalculationList)
          	}
          	formdata['ctContractChargeSummaryList'] = JSON.stringify(array)
          }
          if (this.inputForm.contractTypeId == 2) {
          	formdata['ctContractChargeSummaryList'] = JSON.stringify(this.newList)
          }
          for (var key in this.inputForm) {
          	if (typeof this.inputForm[key] == 'object') {
          		if (this.inputForm[key] && key != 'ctContractChargeSummaryList') {
          			// if (key == 'ctContractProjectList') {
          			//   let arr = []
          			//   arr.push(this.inputForm[key])
          			//   formdata.append(key, JSON.stringify(arr))
          			// } else {
          			formdata[key] = JSON.stringify(this.inputForm[key])
          			// }

          		}
          	} else {
          		if (this.inputForm[key] || this.inputForm[key] == 0) {
          			// if (key == 'ctContractProjectList') {
          			//   let arr = []
          			//   arr.push(this.inputForm[key])
          			//   formdata.append(key, JSON.stringify(arr))
          			// } else {
          			formdata[key] = this.inputForm[key]
          			// }
          		}
          	}
          }
          if (this.method == 'continue') {
            relet(formdata).then((response) => {
              if (response.data.data) {
                this.BeforeClose()
                this.$emit('refreshDataList')
                this.$message.success('续租成功')
              } else {
                this.$notify.error('续租失败')
              }
            })
          } else {
            if (this.inputForm.id) {
              addObj(formdata).then((data) => {
                this.$message.success('修改成功')
                this.$emit('refreshDataList')
                this.BeforeClose()
              })
            } else {
              addObj(formdata).then((data) => {
                this.$message.success('添加成功')
                this.$emit('refreshDataList')
                this.BeforeClose()
              })
            }
          }
        }
      })
    },
    createFilter(queryString, companyNameList) {
      return (companyNameList) => {
        // return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
        if (companyNameList && companyNameList.value) {
          return companyNameList.value.indexOf(queryString) !== -1
        } else {
          return companyNameList
        }
      }
    },
    querySearch(queryString, cb) {
      var restaurants = this.companyNameList
      var results = queryString
        ? restaurants.filter(
            this.createFilter(queryString, this.companyNameList)
          )
        : restaurants
      // 调用 callback 返回建议列表的数据
      cb(results)
    },
    handleSelect(item) {
      console.log(item)
    },
    //验证是否是整月
    doCheckMonthStatus() {
      var that = this
      if (that.method == 'continue') {
        that.inputForm.dateall = JSON.parse(JSON.stringify(that.dateall))
      }
      if (!that.inputForm.dateall || that.inputForm.dateall.length == 0) {
        return
      }
      let startd = ''
      let endd = ''
      // 下面6个参数用来获取当前月多少天的
      let starty = ''
      let startm = ''
      let startday = ''
      let endy = ''
      let endm = ''
      let endday = ''
      if (that.inputForm.dateall && that.inputForm.dateall.length > 0) {
        startd = that.inputForm.dateall[0].substr(8, 2)
        endd = that.inputForm.dateall[1].substr(8, 2)
        starty = that.inputForm.dateall[0].split('-')[0]
        startm = that.inputForm.dateall[0].split('-')[1]
        startday = that.inputForm.dateall[0].split('-')[2]

        endy = that.inputForm.dateall[1].split('-')[0]
        endm = that.inputForm.dateall[1].split('-')[1]
        endday = that.inputForm.dateall[1].split('-')[2]
      }
      // 判断是否是整月
      if (parseInt(startday) == 1) {
        if (new Date(endy, endm, 0).getDate() != parseInt(endday)) {
          this.$message.error('合同日期必须是整月')
          this.inputForm.dateall = []
          return
        }
      } else if (
        parseInt(startday) > 1 &&
        parseInt(startday) < new Date(starty, startm, 0).getDate()
      ) {
        if (parseInt(endday) != parseInt(startday) - 1) {
          this.$message.error('合同日期必须是整月')
          this.inputForm.dateall = []
          return
        }
      } else {
        if (parseInt(endday) != new Date(endy, endm, 0).getDate() - 1) {
          this.$message.error('合同日期必须是整月')
          this.inputForm.dateall = []
          return
        }
      }
      if (this.method == 'continue') {
        this.isChangeDate = true
      }
      this.inputForm.rentStartTime = this.inputForm.dateall[0]
      this.inputForm.rentEndTime = this.inputForm.dateall[1]
      if (that.inputForm.dateall && that.inputForm.dateall.length > 0) {
        let starty = parseInt(that.inputForm.dateall[0].substr(0, 4))
        let endy = parseInt(that.inputForm.dateall[1].substr(0, 4))
        let startm = parseInt(that.inputForm.dateall[0].substr(5, 2))
        let endm = parseInt(that.inputForm.dateall[1].substr(5, 2))
        this.MaxMonth = (endy - starty) * 12 + (endm - startm)
        if (
          this.inputForm.contractTypeId == 0 ||
          this.inputForm.contractTypeId == 1
        ) {
          this.scglchange()
          if (this.inputForm.contractTypeId == 0) {
            this.zjxxchange()
          }
        } else {
          this.getAllTotoalMoney()
        }
      }
    }
  }
}
</script>
<style lang="scss" scoped>
/deep/.el-collapse-item__content {
  display: flex;
  flex-wrap: wrap;
}
/deep/ .el-collapse-item__header{
 font-size: 16px;
  height: 50px;
  margin-left: 20px;
  width:160px;
}

/deep/ .el-collapse-item  .el-collapse-item__header{
  color: black;
  font-weight: 600;
}
/deep/  .el-collapse-item__content{
  border-bottom: 0.5px solid #E4E4E4;
  border-top: 0.5px solid #E4E4E4;
  padding: 20px 0px;

}
/deep/ .el-collapse-item__wrap{
  border: 0px;
}
/deep/ .el-icon-arrow-right:before{
  content: '';
}
</style>
